#ifndef MAINAPP_H
#define MAINAPP_H

#include "socket_httpserver.h"
#include "record_manager.h"
#include "cut_util.h"
#include "merge_util.h"

 #define WEB_ROOT_DIR "/mnt/share/xwproj/web"

class MainApp
{
public:    
    MainApp();
    ~MainApp();

    void start_app();
    void stop_app();

    string on_video_record(string cmd);   
    string on_video_cut(string cmd);
    string on_video_merge(string cmd);
    string on_video_duration(string cmd);   
    string on_video_add_subtitle(string cmd); 
   
public:
    void proc_http_msg(CHttpReq *req);

private:
    vector<string> get_param_values(string cmd);
    string urldecode(const std::string& str);     
    int get_video_duration(string filename, string& alltime);
private:
    string app_path_;
    CHttpServer* http_server_;
    RecordManager* record_manager_;
};


#endif //MAINAPP_H